#include<iostream>
#include<string>
#include <regex>
using namespace std;

class Solution {
public:
    bool isNumber(string s) {
         s = s.erase(0, s.find_first_not_of(" "));
         s = s.erase(s.find_last_not_of(" ") + 1);
         regex r("[+-]?((\\d+(\\.\\d+)?)|(\\.\\d+)|(\\d+\\.))([eE][+-]?\\d+)?");
         return regex_match(s, r);
    }
};